<template>
  <wd-tabbar
    v-model="tabbar"
    fixed
    bordered
    safe-area-inset-bottom
    placeholder
    @change="handleChange1"
  >
    <wd-tabbar-item title="首页" icon="home" name="/pages/home/index" />
    <wd-tabbar-item title="工作台" icon="list" name="/pages/workbench/index" />
    <wd-tabbar-item title="我的" icon="user" name="/pages/profile/index" />
  </wd-tabbar>
</template>

<script setup lang="ts">
  import { getCurrentPageUrl } from '@/utils/page';
  import { onShow } from '@dcloudio/uni-app';
  import { ref } from 'vue';

  const tabbar = ref('');

  onShow(() => {
    console.log('onShow');
    tabbar.value = '/' + getCurrentPageUrl();
  });

  function handleChange1({ value }: { value: string }) {
    uni.switchTab({ url: value });
  }

  uni.hideTabBar();
</script>

<style scoped></style>
